import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ConfigModule } from '@nestjs/config';
import * as path from 'path';
import config from './config';
import config2 from './config2';

@Module({
  imports: [
    // ConfigModule.forRoot()  .env
    ConfigModule.forRoot({
      isGlobal: true, //这样app以外模块才能注入
      //envFilePath: [path.join(process.cwd(), '.aaa.env'), path.join(process.cwd(), '.env')]
      load: [config2,config]
    })

   /* 局部模块,下面这段代码一般放在自定义的模块中 
     ConfigModule.forFeature(()=>{
      return {
        ddd: 222
      }
    }) 
    
    而 register 用于一次性的配置

    */



  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
